package xyz.luckyli.springcloud.service;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import xyz.luckyli.springcloud.pojo.Dept;

import java.util.List;

/**
 * ClassName:DeptClientServiceFallbackFactory
 * Package:xyz.luckyli.springcloud.service
 * Description:
 *
 * @Date:2020/11/18 10:43
 * @Author:857251389@qq.com
 */
@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public DeptClientService create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept queryById(Long id) {
                return new Dept()
                        .setDeptno(id)
                        .setDname("没有该用户信息")
                        .setDbSource("数据库中没有该用户信息");
            }

            @Override
            public List<Dept> queryAll() {
                return null;
            }

            @Override
            public Boolean addDept(Dept dept) {
                return null;
            }
        };
    }
}
